package myactor

import akka.actor.{Actor, ActorSystem, Props}
import com.typesafe.config.ConfigFactory


class  MyResourceManager extends  Actor{
  def doHello():Unit={
    println("MyResourceManager : 接收到了NodeManager的Hello 消息")
  }
  override def receive: Receive = {
    case "Hello" =>{
      doHello()
      sender() ! "Hi"
    }
  }
}

object MyResourceManager {

  def main(args: Array[String]): Unit = {
    val str=
      """
        |akka.actor.provider = "akka.remote.RemoteActorRefProvider"
        |akka.remote.netty.tcp.hostname =localhost
        |akka.remote.netty.tcp.port=19888
      """.stripMargin
    val config = ConfigFactory.parseString(str)
    val actorSystem = ActorSystem("MyResourceManagerActorSystem", config)
    actorSystem.actorOf(Props(new MyResourceManager()), "MyResourceManagerActor")
  }
}
